import java.util.Arrays;
import java.util.Scanner;

/**
 * @author gao
 * @date 2025/9/15 9:15
 */

public class Solution {
    public int numRescueBoats(int[] people, int limit) {
        Arrays.sort(people);
        int boat = 0, left = 0, right = people.length - 1;

        while (left <= right) {
            if (people[left] + people[right] <= limit) {
                left++;
            }
            right--;
            boat++;
        }

        return boat;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int[] people = new int[n];
            for (int i = 0; i < people.length; i++) {
                people[i] = in.nextInt();
            }
            int limit = in.nextInt();
            Solution solution = new Solution();
            System.out.println(solution.numRescueBoats(people, limit));
        }
    }
}